package com.xxxx.util.mail;

import java.io.IOException;
import java.util.Map;

import org.beetl.core.Configuration;
import org.beetl.core.GroupTemplate;
import org.beetl.core.Template;
import org.beetl.core.resource.ClasspathResourceLoader;

import com.xxxx.common.MailContextHelper;

/** 
* @author wangyan E-mail: 417791635@qq.com
* @version 创建时间：2016年9月22日 下午5:29:51 
* 类说明 
*/
public class MailContextHelperImpl extends MailContextHelper {

	@Override
	public String mergeTemplateIntoString(String tplName, String charset, Map<String, Object> data) {
		ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader("templates/");
		Configuration cfg=null;
		String str="";
		try {
			cfg = Configuration.defaultConfiguration();
			GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
			Template t = gt.getTemplate("/hello.txt");
			str = t.render();
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println(str);
		return str;
	}

}
